package com.pengweiwei.androidzygote.functions.csutomviews;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.ogaclejapan.smarttablayout.SmartTabLayout;
import com.pengweiwei.androidzygote.R;
import com.putong35.common.baseactfrag.activity.BaseActivity;
import com.putong35.common.customviews.ImageViewPager;

import butterknife.BindView;


public class ViewPagerActivity extends BaseActivity {

    @BindView(R.id.vpDefault)
    ImageViewPager vpDefault;

    @BindView(R.id.vpAutoSwitch)
    ImageViewPager vpAutoSwitch;

    @BindView(R.id.vpWithIndicator)
    ImageViewPager vpWithIndicator;

    @BindView(R.id.indicator)
    SmartTabLayout indicator;

    @BindView(R.id.stlAutoSwitch)
    SmartTabLayout indicatorOfAutoSwitchVP;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setTitle("ViewPager");

        int[] drawableIds = {R.mipmap.ic_launcher, R.mipmap.ic_launcher, R.mipmap.ic_launcher};
        vpDefault.setupDrawableIds(drawableIds);

        vpWithIndicator.setupDrawableIds(drawableIds);
        indicator.setViewPager(vpWithIndicator);

        vpAutoSwitch.setupDrawableIds(drawableIds);
        indicatorOfAutoSwitchVP.setViewPager(vpAutoSwitch);

        ViewPagerAutomator viewPagerAutomator = new ViewPagerAutomator(vpAutoSwitch, indicatorOfAutoSwitchVP);
        viewPagerAutomator.setInterval(1200);
        viewPagerAutomator.start();

    }

    @Override
    public View createDataView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.activity_view_pager, null);
    }


}